package com.smartpower.wattmeter.adapter;


import androidx.annotation.Nullable;

import com.android.basiclib.uitls.CheckUtil;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.clj.fastble.data.BleDevice;
import com.smartpower.wattmeter.R;

import java.util.List;

/**
 * 首页的设备列表
 */
public class FastBleAdapter extends BaseQuickAdapter<BleDevice, BaseViewHolder> {

    public FastBleAdapter(@Nullable List<BleDevice> data) {
        super(R.layout.item_device, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, BleDevice item) {
        helper.setText(R.id.tv_device_name, CheckUtil.isEmpty(item.getName()) ? "Null" : item.getName())
                .setText(R.id.tv_device_mac, item.getMac())
                .addOnClickListener(R.id.ll_item_box);
    }
}
